// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "GameFramework/Actor.h"
#include "MPU6050Server.h"
#include "ActorPose.h"
#include "MPU6050Actor.generated.h"


UCLASS()
class MPU6050TEST_API AMPU6050Actor : public AActor, public MPU6050Interface
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AMPU6050Actor();

	UFUNCTION(BlueprintImplementableEvent, Category = MPU6050)
		void EventAcceleration(float x, float y, float z);

	UFUNCTION(BlueprintImplementableEvent, Category = MPU6050)
		void EventAngularSpeed(float x, float y, float z);

	UFUNCTION(BlueprintImplementableEvent, Category = MPU6050)
		void EventAngle(float roll, float pitch, float yaw);

	UPROPERTY(Category = MPU6050, VisibleDefaultsOnly, BlueprintReadOnly)
		FVector CurrentPosition;

	UPROPERTY(Category = Display, VisibleDefaultsOnly, BlueprintReadOnly)
		FRotator CurrentRotation;

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	virtual void EndPlay(const EEndPlayReason::Type EndPlayReason);

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	//MPU6050Interface Begin
	virtual void OnAcceleration(float x, float y, float z);
	virtual void OnAngularSpeed(float x, float y, float z);
	virtual void OnAngle(float roll, float pitch, float yaw);
	//MPU6050Interface End
	
private:
	MPU6050Server* mpuServer;
	ActorPose actorPose;
};
